﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OnlineShop.Models
{
    public interface IOnlineShopRepository
    {
        IQueryable<Category> GetListCategory(bool ActivedOnly = true);

        Product GetDetailProduct(int productId);
        void AddProduct(Product product);
        void DeleteProduct(int productId);
        int CountTotalProduct();
        int CountProductByCategory(int categoryId);

        IQueryable<Product> FindProductsByName(string name);
        IQueryable<Product> FindProductsByCategory(int categoryId);
        IQueryable<Product> GetHotProducts();

        OSUser ValidateUser(string loginName, string password);
        OSUser FindUserByLoginName(string loginName);
        void AddUser(OSUser user);

        IQueryable<Order> FindOrdersByUser(int userId);
        IQueryable<Order> FindOrderByProduct(int productId);
        void AddOrder(Order order);
        void DeleteOrder(int orderId);

        IQueryable<OrderDetail> FindOrderDetailByOrder(int orderId);
        void AddOrderDetail(OrderDetail orderDetail);

        void CommitChanges();
    }
}
